home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / dragon-runner.swf / scripts / ObstacleChar.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  5.8 KB  |  219 lines

  1. package
  2. {
  3.    import flash.display.MovieClip;
  4.    import flash.events.Event;
  5.    
  6.    public class ObstacleChar extends MovieClip
  7.    {
  8.        
  9.       
  10.       private var ┬º\x01\x01\x02\t┬º:* = null;
  11.       
  12.       private var ┬º\x01\x01\x07\x03┬º:* = 10;
  13.       
  14.       internal const DOC_HEIGHT:* = 400;
  15.       
  16.       internal const OBTHEIGHT:* = 62.5;
  17.       
  18.       internal const ARMORDAMAGE:* = 2;
  19.       
  20.       private var ┬º\x01\x01\x06\r┬º:* = null;
  21.       
  22.       private var ┬º\x01\x01\t\x0e┬º:* = null;
  23.       
  24.       private var ┬º\x01\x01\t\x0f┬º:*;
  25.       
  26.       internal const OBTWIDTH:* = 60;
  27.       
  28.       internal const DOC_TOP:* = 0;
  29.       
  30.       private var ┬º\x01\x01\t\x10┬º:Boolean = true;
  31.       
  32.       public var attackable:Boolean;
  33.       
  34.       private var ┬º\x01\x01\f\x0b┬º:String;
  35.       
  36.       internal const DOC_WIDTH:* = 640;
  37.       
  38.       internal const HEALTHDAMAGE:* = 5;
  39.       
  40.       internal const DOC_LEFT:* = 0;
  41.       
  42.       private var ┬º\x01\x01\f\f┬º:Boolean = true;
  43.       
  44.       internal const OBTYPOS:* = 268.75;
  45.       
  46.       public function ObstacleChar()
  47.       {
  48.          ┬º\x01\x01\x02\t┬º = null;
  49.          ┬º\x01\x01\x06\r┬º = null;
  50.          ┬º\x01\x01\t\x0e┬º = null;
  51.          ┬º\x01\x01\x07\x03┬º = 10;
  52.          ┬º\x01\x01\f\f┬º = true;
  53.          ┬º\x01\x01\t\x10┬º = true;
  54.          super();
  55.       }
  56.       
  57.       public function GetCharType() : String
  58.       {
  59.          return "obstacle";
  60.       }
  61.       
  62.       public function ShowFace(param1:*) : *
  63.       {
  64.          switch(param1)
  65.          {
  66.             case 1:
  67.                gotoAndPlay("plantstand");
  68.                ┬º\x01\x01\f\x0b┬º = "plant";
  69.                break;
  70.             case 2:
  71.                gotoAndPlay("bushstand");
  72.                ┬º\x01\x01\f\x0b┬º = "bush";
  73.                break;
  74.             case 3:
  75.                gotoAndPlay("monsterstand");
  76.                ┬º\x01\x01\f\x0b┬º = "monster";
  77.                break;
  78.             case 4:
  79.                gotoAndPlay("trunkstand");
  80.                ┬º\x01\x01\f\x0b┬º = "trunk";
  81.                attackable = false;
  82.                break;
  83.             case 5:
  84.                gotoAndPlay("stonestand");
  85.                ┬º\x01\x01\f\x0b┬º = "stone";
  86.                attackable = false;
  87.                break;
  88.             case 11:
  89.                gotoAndPlay(┬º\x01\x01\f\x0b┬º + "attack");
  90.                break;
  91.             case 22:
  92.                ┬º\x01\x01\f\f┬º = false;
  93.                gotoAndPlay(┬º\x01\x01\f\x0b┬º + "dead");
  94.                break;
  95.             default:
  96.                gotoAndPlay("plantstand");
  97.                ┬º\x01\x01\f\x0b┬º = "plant";
  98.          }
  99.       }
  100.       
  101.       public function Reset() : *
  102.       {
  103.          ┬º\x01\x01\t\x10┬º = true;
  104.          ┬º\x01\x01\f\f┬º = true;
  105.          ShowFace(99);
  106.          ┬º\x01\x01\x02\t┬º.removeEventListener(Event.ENTER_FRAME,┬º\x01\x01\x06\x0e┬º);
  107.          ┬º\x01\x01\x02\t┬º.addEventListener(Event.ENTER_FRAME,┬º\x01\x01\x06\x0e┬º,false,0,true);
  108.       }
  109.       
  110.       public function Init(param1:*, param2:*, param3:*) : *
  111.       {
  112.          ┬º\x01\x01\x02\t┬º = param1;
  113.          ┬º\x01\x01\x06\r┬º = param2;
  114.          ┬º\x01\x01\t\x0e┬º = param3.theKnight;
  115.          ┬º\x01\x01\t\x0f┬º = param3;
  116.          ┬º\x01\x01\t\x10┬º = true;
  117.          attackable = true;
  118.          this.width = OBTWIDTH;
  119.          this.height = OBTHEIGHT;
  120.          this.y = OBTYPOS;
  121.          ┬º\x01\x01\x02\t┬º.addEventListener(Event.ENTER_FRAME,┬º\x01\x01\x06\x0e┬º,false,0,true);
  122.       }
  123.       
  124.       public function GetHealthDamage() : int
  125.       {
  126.          if(┬º\x01\x01\f\f┬º)
  127.          {
  128.             if(┬º\x01\x01\f\x0b┬º == "monster" || ┬º\x01\x01\f\x0b┬º == "plant")
  129.             {
  130.                return HEALTHDAMAGE * 2;
  131.             }
  132.             return HEALTHDAMAGE;
  133.          }
  134.          return 0;
  135.       }
  136.       
  137.       public function SetLive(param1:*) : *
  138.       {
  139.          ┬º\x01\x01\f\f┬º = param1;
  140.          if(!┬º\x01\x01\f\f┬º)
  141.          {
  142.             ShowFace(22);
  143.          }
  144.       }
  145.       
  146.       public function GetLive() : Boolean
  147.       {
  148.          return ┬º\x01\x01\f\f┬º;
  149.       }
  150.       
  151.       public function GetArmorDamage() : int
  152.       {
  153.          if(┬º\x01\x01\f\f┬º)
  154.          {
  155.             if(┬º\x01\x01\f\x0b┬º == "monster")
  156.             {
  157.                return ARMORDAMAGE * 3;
  158.             }
  159.             if(┬º\x01\x01\f\x0b┬º == "plant")
  160.             {
  161.                return ARMORDAMAGE * 2;
  162.             }
  163.             return ARMORDAMAGE;
  164.          }
  165.          return 0;
  166.       }
  167.       
  168.       private function ┬º\x01\x01\x06\x0e┬º(param1:Event) : *
  169.       {
  170.          if(┬º\x01\x01\f\f┬º)
  171.          {
  172.             if(Math.abs(┬º\x01\x01\t\x0e┬º.x - this.x) <= ┬º\x01\x01\t\x0e┬º.width * 0.5 && ┬º\x01\x01\t\x10┬º)
  173.             {
  174.                ShowFace(11);
  175.                ┬º\x01\x01\t\x10┬º = false;
  176.             }
  177.             if(this.x > -100)
  178.             {
  179.                this.x -= ┬º\x01\x01\x07\x03┬º;
  180.             }
  181.             else
  182.             {
  183.                ┬º\x01\x01\t\x0f┬º.DestroyObstacle(this);
  184.             }
  185.          }
  186.          else if(this.currentLabel == "smokeend")
  187.          {
  188.             ┬º\x01\x01\t\x0f┬º.DestroyObstacle(this);
  189.          }
  190.          else if(this.x > -100)
  191.          {
  192.             this.x -= ┬º\x01\x01\x07\x03┬º;
  193.          }
  194.          else
  195.          {
  196.             ┬º\x01\x01\t\x0f┬º.DestroyObstacle(this);
  197.          }
  198.       }
  199.       
  200.       public function Destroy() : *
  201.       {
  202.          ┬º\x01\x01\x02\t┬º.removeEventListener(Event.ENTER_FRAME,┬º\x01\x01\x06\x0e┬º);
  203.       }
  204.       
  205.       public function GetCharScore() : int
  206.       {
  207.          if(┬º\x01\x01\f\x0b┬º == "plant")
  208.          {
  209.             return 100;
  210.          }
  211.          if(┬º\x01\x01\f\x0b┬º == "monster")
  212.          {
  213.             return 250;
  214.          }
  215.          return 50;
  216.       }
  217.    }
  218. }
  219.